package com.xiaoxi.codemodelserver.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xiaoxi.codemodelserver.domain.dto.BMSCodeModelDTO;
import com.xiaoxi.codemodelserver.domain.vo.BMSCodeModelVO;
import com.xiaoxi.common.exception.BMSException;
import com.xiaoxi.domain.quick.BmsCodeModel;
import org.springframework.data.domain.Pageable;

/**
 * @ClassName BmsCodeModelService
 * @Description
 * @Author xiaoxi
 * @Date 2022-11-05
 * @Version 1.0
 */
public interface BmsCodeModelService extends IService<BmsCodeModel> {

    /**
     * 查询分页数据
     *
     * @param bmsCodeModelDTO 查询条件
     * @param pageable        分页规则
     * @return
     */
    IPage<BMSCodeModelVO> findListByPage(BMSCodeModelDTO bmsCodeModelDTO, Pageable pageable) throws BMSException;

    /**
     * 添加
     *
     * @param bmsCodeModelVO
     */
    void add(BMSCodeModelVO bmsCodeModelVO) throws BMSException;

    /**
     * 删除
     *
     * @param id 主键
     */
    void delete(Long id) throws BMSException;

    /**
     * 修改
     *
     * @param bmsCodeModelVO
     * @return JsonBean
     */
    void update(BMSCodeModelVO bmsCodeModelVO) throws BMSException;

    /**
     * id查询数据
     *
     * @param id id
     * @return BmsCodeModel
     */
    BmsCodeModel findById(Long id) throws BMSException;


    /**
     * 检查codeType 是否重复 --- 代码标识
     *
     * @param codeType
     * @return
     */
    Boolean checkCodeType(String codeType, Long id);

    /**
     * 检查代码名称是否重复
     *
     * @param name
     * @return
     */
    Boolean checkName(String name, Long id);

    /**
     * 启用 代码模型
     *
     * @param id
     */
    void enableCodeModel(Long id) throws BMSException;

    /**
     * 通过代码标识 获取  代码模型
     *
     * @param codeType
     * @return
     */
    BmsCodeModel getCodeModel(String codeType);
}
